If you're working
on a new feature, you might work on a branch
called feature/sign up and only once that feature has been
finished and entirely tested, we want to get all those
changes into the master branch. We can merge a branch
with a git merge command. The Git merge command
receives the name of the branch that we want to
merge into our current branch. In this case, we first have to check out to
the master branch in order to merge
feature/sign up into master. We can now merge by typing
Git merge feature/sign up. There are two types of
merges that Git can perform a fast forward merge or
a no fast forward merge. A fast forward merge
can happen when the current branch has no extra commits compared to the branch that
we're merging. Git is lazy, and we'll first try to perform the easiest
option, the fast forward. This type of merge doesn't
create a new commit, but rather merges the
commits on the branch that we're merging right
into the current branch. Since the master branch doesn't contain any extra commits, we can merge the branch
directly into master. Perfect. We now have all
the changes that were made on the branch available
on the master branch. So what's the no fast
forward all about? It's great if your current
branch doesn't have any extra commits compared to the branch that
you want to merge. But unfortunately,
that's rarely the case. If we committed changes on the current branch that the branch we want to
merge doesn't have, Git will perform a no
fast forward merge. With a no fast forward merge, Git creates a new merging
commit on the active branch. The commits parent
commit point to both the active branch and the branch that
we want to merge. No big deal, a perfect merge. The master branch now contains all the changes
that we've made. That's it for this lecture. Head over to the labs and start practicing what
you've just learned.